<?php
// phpinfo();die;
//接受参数
$m = isset($_GET['m'])?$_GET['m']:'Home';//控制器名
define("MODULE",$m);//模块名
$c = isset($_GET['c'])?$_GET['c']:'Match';//控制器名
define("CONTROLLER",$c);
$a = isset($_GET['a'])?$_GET['a']:'index';//方法名
define("ACTION",$a);

//自动加载实现
spl_autoload_register('myload');
//映射数组
$array = array(
	'Factory' => './framework/Factory.class.php',
	'Model'   => './framework/Model.class.php',
	'MysqlDb' => './framework/MysqlDb.class.php',
	'Smarty' => './framework/lib/smarty/Smarty.class.php',
	'Controller' => './framework/Controller.class.php',
);
function myload($class){
	global $array;
	if(isset($array[$class])){
		require_once($array[$class]);
	}
	elseif(substr($class,-10) == 'Controller'){
		require_once('./app/'.MODULE.'/Controller/'.$class.'.class.php');

	}
	elseif(substr($class,-5) == 'Model'){
		require_once('./app/'.MODULE.'/Model/'.$class.'.class.php');
	}
}

//动态可变控制器
$controller = $c.'Controller';
$con = new $controller();
$con->$a();